#pragma once
#include "C_SQLite.h"
#include "C_SQLiteQuery.h"

class C_Map;
class C_SpaceStar;
class C_SpaceObjectFactory;

enum E_SpaceObject {
	SO_STAR = 0,
	SO_PLANET = 1
};
class C_SQLiteSpaceObject
{
	C_SQLite *m_sql;
	C_Map *m_map;
	C_SpaceObjectFactory* m_factory;
	std::atomic<bool> m_readyGen;
public:
	C_SQLiteSpaceObject(std::string path);
	~C_SQLiteSpaceObject();

	inline void setFactory(C_SpaceObjectFactory* f) { m_factory = f; }
	inline bool getReady() { return (m_readyGen) ? true : false; }

	void bind(C_Map* map) { m_map = map; }
	void add(E_SpaceObject type, int x, int y, int fx, int fy, std::string data);
	void loadSpaceObjects(S_Rangei x, S_Rangei y);
	void loadFromJSON(std::string str, C_SpaceStar *star);
};

